package com.gxa.company.controller;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.gxa.company.service.CompanyService;
import dto.ResultDTO;
import entity.Company;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * 公司表(Company)表控制层
 *
 * @author makejava
 * @since 2021-05-12 09:22:01
 */
@RestController
@RequestMapping(value = "company")
@Api(tags = "企业配置")
public class CompanyController {
    /**
     * 服务对象
     */
    @Resource
    private CompanyService companyService;

    /**
     * 通过主键查询单条数据
     *
     * @param companyId 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    @ApiOperation(value = "查询公司的接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name="companyId",value="companyId",required = true),
    })
    public ResultDTO selectOne(Integer companyId) {
        return this.companyService.queryById(companyId);
    }

    /**
     * 修改
     * @param company
     * @return
     */
    @PostMapping("update")
    @ApiOperation(value = "修改公司信息的接口")
    @ApiOperationSupport(ignoreParameters = {"companyCreateTime","companyIsDeleted","companyId"})
    @ApiImplicitParams({
            @ApiImplicitParam(name="company",value="company",required = true),
    })
    public ResultDTO update(Company company,MultipartFile file){
        return this.companyService.update(company,file);
    }

}
